// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   ReviewOptionProcessor.java

package com.boci.clientapp.trading.processor;

import com.boci.clientapp.trading.vo.ReviewHKOptionVO;
import com.boci.clientapp.trading.vo.ReviewUSOptionVO;
import com.boci.common.constant.RequestTypeConst;
import com.boci.common.processor.AbstractResponseProcessor;
import com.boci.common.vo.ResponseVO;

public class ReviewOptionProcessor extends AbstractResponseProcessor
{

    public ReviewOptionProcessor(String pXML, String pReqType)
        throws Exception
    {
        super(pXML, pReqType, "TRADING.ERROR_");
    }

    public ResponseVO processHKXML()
    {
        String strAcctID = getNodeValue("ACCOUNT_ID");
        String strSymbol = getNodeValue("SYMBOL");
        String strName = getNodeValue("NAME");
        String strChiName = getNodeValue("NAME_CHI");
        String strChsName = getNodeValue("NAME_CHS");
        String strBuyOrSell = getNodeValue("BUY_OR_SELL");
        String strQty = getNodeValue("QUANTITY");
        String strPrice = getNodeValue("PRICE");
        String strOrdType = getNodeValue("ORDER_TYPE");
        String strOrdQual = getNodeValue("ORDER_QUALIFIER");
        String strLotSize = getNodeValue("LOT_SIZE");
        String strReqType = getReqType();
        ReviewHKOptionVO reviewVO = new ReviewHKOptionVO(strReqType, getReturnCode());
        reviewVO.setAccountID(strAcctID);
        reviewVO.setSymbol(strSymbol);
        reviewVO.setName(strName);
        reviewVO.setName_CHI(strChiName);
        reviewVO.setName_CHS(strChsName);
        reviewVO.setBuyOrSell(strBuyOrSell);
        reviewVO.setQuantity(strQty);
        reviewVO.setPrice(strPrice);
        reviewVO.setOrderType(strOrdType);
        reviewVO.setOrderQualifier(strOrdQual);
        reviewVO.setLotSize(strLotSize);
        return reviewVO;
    }

    public ResponseVO processUSXML()
    {
        String strAcctID = getNodeValue("ACCOUNT_ID");
        String strSymbol = getNodeValue("SYMBOL");
        String strName = getNodeValue("NAME");
        String strChiName = getNodeValue("NAME_CHI");
        String strChsName = getNodeValue("NAME_CHS");
        String strBuyOrSell = getNodeValue("BUY_OR_SELL");
        String strQty = getNodeValue("QUANTITY");
        String strPrice = getNodeValue("PRICE");
        String strOrdType = getNodeValue("ORDER_TYPE");
        String strOrdQual = getNodeValue("ORDER_QUALIFIER");
        String strReqType = getReqType();
        ReviewUSOptionVO reviewVO = new ReviewUSOptionVO(strReqType, getReturnCode());
        reviewVO.setAccountID(strAcctID);
        reviewVO.setSymbol(strSymbol);
        reviewVO.setName(strName);
        reviewVO.setChiName(strChiName);
        reviewVO.setName_CHS(strChsName);
        reviewVO.setBuyOrSell(strBuyOrSell);
        reviewVO.setQuantity(strQty);
        reviewVO.setPrice(strPrice);
        reviewVO.setOrderType(strOrdType);
        reviewVO.setOrderQualifier(strOrdQual);
        return reviewVO;
    }

    public ResponseVO processXML()
        throws Exception
    {
        String strReqType = getReqType();
        if(strReqType.equals(RequestTypeConst.BOCI_HK_OPTION_REVW_URL))
            return processHKXML();
        if(strReqType.equals(RequestTypeConst.BOCI_US_OPTION_REVW_URL))
            return processUSXML();
        else
            return null;
    }
}
